package com.demo.web.modules.sys;

import com.demo.common.constant.api.SysBasicVOAPIConstant;
import com.demo.common.result.ResponseInfo;
import com.demo.common.result.ResultVo;
import com.demo.service.sys.SysBasicVOService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sys/basic_vo")
public class SysBasicVOController  {
    @Autowired
    private SysBasicVOService myService;

    @GetMapping("/test")
    public String test(){
        return "hello, you are in SysBasicVO test!";
    }

    //菜单树
    @RequestMapping(value = SysBasicVOAPIConstant.MENU_VO_TREE, method = RequestMethod.POST)
    public ResultVo getMenuTree(){
        return ResponseInfo.<Object>success(myService.getMenuTreeVO());
    }

    //公司树型列表
    @RequestMapping(value = SysBasicVOAPIConstant.COMPANY_VO_TREE, method = RequestMethod.POST)
    public ResultVo getCompanyVOTree(){
        return ResponseInfo.<Object>success(myService.getCompanyVOTree());
    }

    //字典分类树
    @RequestMapping(value = SysBasicVOAPIConstant.DICTIONARY_TYPE_VO_TREE, method = RequestMethod.POST)
    public ResultVo getDictionaryTypeVOTree(){
        return ResponseInfo.<Object>success(myService.getDictionaryTypeVOTree());
    }

    //根据图片url查询图元
    @RequestMapping(value = SysBasicVOAPIConstant.TUPLE_SEARCH_ITEM, method = RequestMethod.POST)
    public ResultVo getTupleListByURL(@RequestBody String url){
        return ResponseInfo.<Object>success(myService.getTupleListByURL(url));
    }
}
